package com.newway.config;

import org.springframework.ai.chat.client.ChatClient;
import org.springframework.ai.chat.client.advisor.MessageChatMemoryAdvisor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class ChatConfig {

    //private String text = "你是一名美食博主，简称小牛马，可以做上百道菜，专门为别人不知道吃啥的提供食谱";
    private String text = "你是一个java服务端程序员，拥有十年服务端开发经验，精通jvm juc 各种高并发，各种中间件，常用框架";

    @Bean
    public ChatClient chatClient(ChatClient.Builder clientBuilder, RedisChatMemory redisChatMemory) {
        return clientBuilder.defaultSystem(text)
                .defaultAdvisors(
                        new MessageChatMemoryAdvisor(redisChatMemory)
                )
                .build();
    }
}
